Skip to main content

Play Metadata Field

This script returns the value for the specified metadata field associated with a play in the TopShot smart contract.

Parameters:

  • playID: The unique ID for the play whose data needs to be read
  • field: The specified metadata field whose data needs to be read

Returns: String - Value of specified metadata field associated with specified playID

import TopShot from 0xTOPSHOTADDRESS

pub fun main(playID: UInt32, field: String): String {

let field = TopShot.getPlayMetaDataByField(playID: playID, field: field) ?? panic("Play doesn't exist")

return field
}